<template>
  <div class="detail">
    <detail-banner @getHeight="handleHeight"></detail-banner>
    <detail-header :bannerHeight="bannerHeight"></detail-header>
    <detail-info></detail-info>
    <detail-ticket></detail-ticket>
    <detail-list :list="list"></detail-list>
    <detail-comment></detail-comment>
    <div class="content"></div>
  </div>
</template>

<script>
import DetailBanner from './components/Banner'
import DetailHeader from './components/Header'
import DetailInfo from './components/Info'
import DetailTicket from './components/Ticket'
import DetailList from './components/List'
import DetailComment from './components/Comment'
import axios from 'axios'
export default {
  name: 'Detail',
  components: {
    DetailBanner,
    DetailHeader,
    DetailInfo,
    DetailTicket,
    DetailList,
    DetailComment
  },
  data () {
    return {
      bannerHeight: 0,
      list: [{
        title: '成人票',
        children: [{
          title: '成人票-1',
          children: [{
            title: '成人票-1-01'
          }]
        }, {
          title: '成人票-2'}]
      }, {
        title: '学生票'
      }, {
        title: '儿童票'
      }]
    }
  },
  methods: {
    handleHeight (height) {
      this.bannerHeight = height
    },
    getDetailInfo () {
      axios.get('/api/detail.json?id=' + this.$route.params.id)
        .then(this.handleGetDetailSucc)
    },
    handleGetDetailSucc (res) {
      res = res.data
      if (res.ret && res.data) {
        const data = res.data
        console.log(data)
      }
    }
  },
  mounted () {
    this.getDetailInfo()
  }
}
</script>

<style lang="stylus" scoped>
  .detail
    background #f5f5f5
    .content
      height 50rem
</style>
